<div class="container" *ngIf="configData">
	<div class="row">
		<div class="col s12">
			<form action="">
				<h1>NIGHTHAWK CONFIG</h1>
			</form>
		</div>
	</div>
	<form class="col s12" [formGroup]="configForm" novalidate (ngSubmit)="updateConfig(configForm.value, configForm.valid, $event)" materialize>
		<div class="row" formGroupName="nighthawk">
			<div class="input-field col s6">
				<input id="ip_addr" type="text" class="validate" formControlName="ip_addr">
				<label class="active" for="ip_addr">nightHawk IP Address</label>
			</div>
			<div class="input-field col s3">
				<input id="max_procs" type="number" class="validate" formControlName="max_procs">
				<label class="active" for="max_procs">Max Processes</label>
			</div>
			<div class="input-field col s3">
				<input id="max_goroutine" type="number" class="validate" formControlName="max_goroutine">
				<label class="active" for="max_goroutine">Max GO routines</label>
			</div>
			<div class="input-field col s3">
				<input id="bulk_post_size" type="number" class="validate" formControlName="bulk_post_size">
				<label class="active" for="bulk_post_size">Bulk POST Size (ES)</label>
			</div>
			<div class="input-field col s3">
				<input id="op_control" type="number" class="validate" formControlName="opcontrol">
				<label class="active" for="op_control">OP Control (logging options)</label>
			</div>
			<div class="input-field col s3">
				<input id="sessiondir_size" type="number" class="validate" formControlName="sessiondir_size">
				<label class="active" for="sessiondir_size">Session Directory Size</label>
			</div>
			<div class="input-field col s3">
				<input type="checkbox" class="filled-in" id="check_hash" formControlName="check_hash" checked="configData.nighthawk.check_hash" />
				<label for="check_hash">Check Hash</label>
			</div>
			<div class="input-field col s3">
				<input type="checkbox" class="filled-in" id="check_stack" formControlName="check_stack" checked="configData.nighthawk.check_stack" />
				<label for="check_stack">Check Stack</label>
			</div>
			<div class="input-field col s3">
				<input type="checkbox" class="filled-in" id="log_verbose" formControlName="verbose" checked="configData.nighthawk.verbose" />
				<label for="log_verbose">Log Verbose</label>
			</div>
			<div class="input-field col s3">
				<input id="verbose_level" type="number" class="validate" formControlName="verbose_level">
				<label class="active" for="verbose_level">Verbosity Level</label>
			</div>
		</div>
		<div class="col 12">
			<div class="row" formGroupName="elastic">
				<div class="input-field col s6">
					<input id="elastic_server" type="text" class="validate" formControlName="elastic_server">
					<label class="active" for="elastic_server">Elastic Server</label>
				</div>
				<div class="input-field col s6">
					<input id="elastic_port" type="number" class="validate" formControlName="elastic_port">
					<label class="active" for="elastic_port">Elastic Port</label>
				</div>
				<div class="input-field col s3">
					<input id="elastic_user" type="text" class="validate" formControlName="elastic_user">
					<label class="active" for="elastic_user">Elastic Username</label>
				</div>
				<div class="input-field col s3">
					<input id="elastic_pass" type="password" class="validate" formControlName="elastic_pass">
					<label class="active" for="elastic_pass">Elastic Password</label>
				</div>
				<div class="input-field col s3">
					<input type="checkbox" class="filled-in" id="elastic_ssl" formControlName="elastic_ssl" checked="configData.elastic.elastic_ssl" />
					<label for="elastic_ssl">Elastic SSL</label>
				</div>
				<div class="input-field col s3">
					<input id="elastic_index" type="text" class="validate" formControlName="elastic_index">
					<label class="active" for="elastic_index">Elastic Index</label>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col s12 center-align">
				<button class="btn waves-effect waves-light modal-trigger" 
				[disabled]="!configForm.valid || !configForm.dirty">Submit
			</button>
		</div>
		<div id="modal1" materialize="modal" [materializeParams]="[{dismissible: true}]" [materializeActions]="modalActions" class="modal bottom-sheet">
			<div class="modal-content" *ngIf="updateResponse">
				<h4>{{updateResponse.response}}</h4>
				<p>HTTP Response: {{updateResponse.reason}}</p>
			</div>
		</div>
	</div>
</form>
</div>